<?php

namespace Common\Model;

use Think\Model;
/**
 * Description of FriendModel
 *
 * @author Administrator
 */
class FriendModel extends Model{
    //put your code here
    function get_friends($user_id){
        //$FriendModel = new \Common\Model\FriendModel();
        //$list = $FriendModel->where("user_id = ".$user_id) ->select();
//        return $friends;
        $Model = new Model();
        $list = $Model->table('dy_user user, dy_friend friend')->where('user.id = friend.friend_id and friend.user_id = '.$user_id)->field('user.username as username, user.nickname as nickname, user.sex as sex, user.phone as phone, friend.add_time as add_time')->order('user.id desc' )->select();
//        for($i = 0; $i < count($list); $i++){
//            $list[i]['password'] = "";
//        }
        //show_bug($Model->getLastSql());
        return $list;
    }
}
